﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pollogger.Library
{
    [Serializable]
    public abstract class LogRepositoryConfiguration
    {
        private LogRepository _repository = null;
        private string _filePath;
        private string _configType;
        private List<LogConfig> _configs = null;
        public LogRepositoryConfiguration(LogRepository repository)
        {
            _repository = repository;
        }
        public LogRepository Repository
        {
            get { return _repository; }
        }

        public string ConfigType
        {
            get
            {
                return _configType;
            }
            set
            {
                _configType = value;
            }
        }

        public List<LogConfig> Loggers
        {
            get
            {
                if (_configs == null)
                {
                    ReloadLoggers();
                }
                return _configs;
            }
        }

        public void ReloadLoggers()
        {
            _configs = new List<LogConfig>();
            LogConfig loggerConfig = LoggerInferrer.GetLoggerConfig(this);
            if (loggerConfig != null)
            {
                _configs.Add(loggerConfig);
            }
        }
        public abstract string GetContent();
    }
}
